//package com.example.demo.controller;
//
//import com.example.demo.entity.Notification;
//import com.example.demo.service.NotificationService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.List;
//import java.util.Map;
//
//@RestController
//@RequestMapping("notifications")
//@CrossOrigin
//public class NotificationController {
//    @Autowired
//    private NotificationService notificationService;
//
//    @PostMapping("/admin/bulk")
//    public String addBulkNotification(@RequestBody Map<String, Object> payload) {
//        List<Integer> user_ids = (List<Integer>) payload.get("user_ids");
//        String content = (String) payload.get("content");
//        boolean success = notificationService.addBulkNotification(user_ids, content);
//        if (success) {
//            return "Notifications added";
//        } else {
//            return "Failed to add notifications";
//        }
//    }
//
//    @PostMapping("/admin/{user_id}")
//    public String addNotification(@PathVariable int user_id, @RequestBody String content) {
//        notificationService.addNotification(user_id, content);
//        return "Notification added";
//    }
//
//    @GetMapping("/users/{user_id}")
//    public List<Notification> getNotifications(@PathVariable int user_id) {
//        return notificationService.getNotificationsByUserId(user_id);
//    }
//
//    @PostMapping("/users/{user_id}/notifications/{notification_id}/read")
//    public String markNotificationAsRead(@PathVariable int user_id, @PathVariable int notification_id) {
//        boolean success = notificationService.markNotificationAsRead(user_id, notification_id);
//        if (success) {
//            return "Notification marked as read";
//        } else {
//            return "Notification not found or already read";
//        }
//    }
//}